<?php

namespace Mediacosmos\UserBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use PUGX\MultiUserBundle\Validator\Constraints\UniqueEntity;

/**
 * Member
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Mediacosmos\UserBundle\Entity\MemberRepository")
 */
/**
 * @ORM\Entity
 * @ORM\Table(name="member")
 * @UniqueEntity(fields = "username", targetClass = "Mediacosmos\UserBundle\Entity\User", message="fos_user.username.already_used")
 * @UniqueEntity(fields = "email", targetClass = "Mediacosmos\UserBundle\Entity\User", message="fos_user.email.already_used")
 */
class Member extends User {

     /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;
    
    /**
     * @ORM\ManyToMany(targetEntity="Mediacosmos\BadgeBundle\Entity\Badge", cascade={"persist"})
     */
    private $badges;
    
    /**
     *
     * @var string 
     * @ORM\Column(name="nom", type="string", length=50, nullable=true)
     */
    private $nom;
    
    /**
     *
     * @var string 
     * @ORM\Column(name="prenom", type="string", length=50, nullable=true)
     */
    private $prenom;
    
    /**
     *
     * @var integer 
     * @ORM\Column(name="age", type="integer", nullable=true)
     */
    private $age;
    
    /**
     *
     * @var string 
     * @ORM\Column(name="description", type="text", nullable=true)
     */
    private $description;
    
    /**
     * @ORM\ManyToMany(targetEntity="Mediacosmos\UserBundle\Entity\Member")
     */
    private $usersFollowed;
    

    /**
     * Constructor
     */
    public function __construct()
    {
        parent::__construct();
        $this->badges = new \Doctrine\Common\Collections\ArrayCollection();
        $this->addRole("ROLE_MEMBER");
    }

    /**
     * Add badges
     *
     * @param \Mediacosmos\BadgeBundle\Entity\Badge $badges
     * @return Member
     */
    public function addBadge(\Mediacosmos\BadgeBundle\Entity\Badge $badges)
    {
        $this->badges[] = $badges;

        return $this;
    }

    /**
     * Remove badges
     *
     * @param \Mediacosmos\BadgeBundle\Entity\Badge $badges
     */
    public function removeBadge(\Mediacosmos\BadgeBundle\Entity\Badge $badges)
    {
        $this->badges->removeElement($badges);
    }

    /**
     * Get badges
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getBadges()
    {
        return $this->badges;
    }

    /**
     * Set nom
     *
     * @param string $nom
     * @return Member
     */
    public function setNom($nom)
    {
        $this->nom = $nom;

        return $this;
    }

    /**
     * Get nom
     *
     * @return string 
     */
    public function getNom()
    {
        return $this->nom;
    }

    /**
     * Set prenom
     *
     * @param string $prenom
     * @return Member
     */
    public function setPrenom($prenom)
    {
        $this->prenom = $prenom;

        return $this;
    }

    /**
     * Get prenom
     *
     * @return string 
     */
    public function getPrenom()
    {
        return $this->prenom;
    }

    /**
     * Set age
     *
     * @param integer $age
     * @return Member
     */
    public function setAge($age)
    {
        $this->age = $age;

        return $this;
    }

    /**
     * Get age
     *
     * @return integer 
     */
    public function getAge()
    {
        return $this->age;
    }

    /**
     * Set description
     *
     * @param string $description
     * @return Member
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }

    /**
     * Get description
     *
     * @return string 
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Add usersFollowed
     *
     * @param \Mediacosmos\UserBundle\Entity\Member $usersFollowed
     * @return Member
     */
    public function addUsersFollowed(\Mediacosmos\UserBundle\Entity\Member $usersFollowed)
    {
        $this->usersFollowed[] = $usersFollowed;

        return $this;
    }

    /**
     * Remove usersFollowed
     *
     * @param \Mediacosmos\UserBundle\Entity\Member $usersFollowed
     */
    public function removeUsersFollowed(\Mediacosmos\UserBundle\Entity\Member $usersFollowed)
    {
        $this->usersFollowed->removeElement($usersFollowed);
    }

    /**
     * Get usersFollowed
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getUsersFollowed()
    {
        return $this->usersFollowed;
    }
}
